package com.freeter.common.utils;

import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;

import java.util.Date;

/**
 * @author Jerry.Li
 * @description
 * @date 2021/9/13 20:03
 */
@Slf4j
public class LogStashUtil {
    /**
     * 发送日志
     *
     * @param username
     * @param type
     * @param content
     * @param createTime
     * @param parameters
     */
    public static void sendMessage(String username, String type, String content,
                                   Date createTime, String parameters) {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("username", username);
        jsonObject.put("type", type);
        jsonObject.put("content", content);
        jsonObject.put("parameters", parameters);
        jsonObject.put("createTime", createTime);

        log.info(jsonObject.toString());
    }
}
